package lab02.test13;

/**
 * Created by 阿阿阿阿豪丶 on 2017/10/20.
 */
public class Gymnastics extends ComputerAverage {
    @Override
    double average(double[] scores) {
        int i;
        double max;
        double min;
        double sum = 0;
        double average = 0;
        min = max = scores[0];
        for (i = 0; i < scores.length; i++) {
            System.out.print(scores[i] + " ");
            if (scores[i] > max)   // 判断最大值
                max = scores[i];
            if (scores[i] < min)   // 判断最小值
                min = scores[i];
        }
        for (i = 0; i < scores.length; i++) {
            if (max == scores[i])
                scores[i] = 0;
            if (min == scores[i])
                scores[i] = 0;
        }
        for (i = 0; i < scores.length; i++) {
            sum = sum + scores[i];
            average = sum / 6;
        }
        return average;
    }
}
